#!/bin/bash

# there're multiple methods to execute multiple sed command from the command line. 

#-- Basic Way to Use Multiple Sed Command --
# > sed -e 'command 1' -e 'command 2' -e 'command 3'

# - serach for root or nobody or mail in the /etc/passwd
sed -n -e '/^root/ p' -e '/^nobody/ p' -e '/^mail/ p' /etc/passwd
echo -e '\n'


#-- Break-up serveral sed command using \
# we can use '\' back-slash to break up single command line

sed -n -e '/^root/ p' \
    -e '/^nobody/ p' \
    -e '/^mail/ p' \
    /etc/passwd
echo -e '\n'

#-- Group Multiple Sed Command Using {}

sed -n '{
    /^root/ p
    /^nobody/ p
    /^mail/ p
}' /etc/passwd
